﻿<UserControl x:Class="ScrumFactory.Team.MyDay"
             xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
             xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
             xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" 
             xmlns:d="http://schemas.microsoft.com/expression/blend/2008" 
             
             xmlns:props="clr-namespace:ScrumFactory.Team.Properties" 
             xmlns:SF_Comp="clr-namespace:ScrumFactory.Composition;assembly=ScrumFactory.Composition"
             xmlns:SF_Helpers="clr-namespace:ScrumFactory.Windows.Helpers;assembly=ScrumFactory.Windows.Helpers"
          
             mc:Ignorable="d" 
             d:DesignHeight="300" d:DesignWidth="300"
             
             x:Name="thisView"
             
             SF_Comp:CommandBehavior.RoutedEventName="Loaded"
            SF_Comp:CommandBehavior.TheCommandToRun="{Binding OnLoadCommand}">
    
    <UserControl.Resources>

        <ResourceDictionary>
            <ResourceDictionary.MergedDictionaries>
                <ResourceDictionary Source="Style/TeamStyles.xaml"/>
            </ResourceDictionary.MergedDictionaries>
        </ResourceDictionary>

    </UserControl.Resources>

    
    
    <SF_Helpers:PanelLayout Title="{Binding PanelName}">

        <SF_Helpers:PanelLayout.Toolbar>
            <ToolBar>
                <StackPanel Orientation="Horizontal" Margin="10,0,0,0" DataContext="{Binding MemberTotalEngagement}">
                    <Viewbox Width="32" Height="32" Stretch="Fill" VerticalAlignment="Center">
                    <Path                                           
                        x:Name="totalEngagement"                                                                                                                        
                        Style="{StaticResource DayAllocationPath}"/>
                    </Viewbox>
                    <TextBlock Style="{StaticResource AllocationToolTipTextBlock}"
                                VerticalAlignment="Center" Margin="10,0,0,0"
                                Foreground="{StaticResource LabelBrush}"
                                FontFamily="{StaticResource WideFont}"
                                FontSize="{StaticResource ReallyBigFontSize}"/>
                </StackPanel>
            </ToolBar>
            
        </SF_Helpers:PanelLayout.Toolbar>
        
        <SF_Helpers:PanelLayout.Content>
            <ScrollViewer VerticalScrollBarVisibility="Auto">
                <Grid>
                    <Grid.Style>
                        <Style>
                            <Style.Triggers>
                                <DataTrigger Binding="{Binding IsVisible}" Value="False">
                                    <Setter Property="Grid.Visibility" Value="Collapsed"/>
                                </DataTrigger>
                            </Style.Triggers>
                        </Style>
                    </Grid.Style>
                    <Grid.RowDefinitions>
                        <RowDefinition Height="auto"/>
                        <RowDefinition Height="auto"/>
                        <RowDefinition Height="*"/>
                    </Grid.RowDefinitions>
                    <Grid.ColumnDefinitions>
                        <ColumnDefinition Width="*" x:Name="taskCollumn"/>
                        <ColumnDefinition Width="*"/>
                        <ColumnDefinition Width="auto"/>
                    </Grid.ColumnDefinitions>

                    <ContentControl Grid.ColumnSpan="2" Grid.Row="0" Content="{Binding PendingMembershipsListViewModel.View}"/>

                    <StackPanel Grid.ColumnSpan="2" Grid.Row="1" Orientation="Vertical"  Margin="0">

                        <TextBlock Text="{x:Static props:Resources.My_Engagement}" Style="{StaticResource TitleTextBlock}" Margin="0,15,0,5"/>
                        <ListBox
                            x:Name="engagementList"  
                            Style="{StaticResource MemberEngagementListBox}"
                            ItemsSource="{Binding MemberEngagedProjects}"/>
                        <TextBlock Style="{StaticResource NoItemsTextBlock}" DataContext="{Binding ElementName=engagementList, Path=Items.Count}"/>

                    </StackPanel>


                    <StackPanel Grid.Column="0" Grid.Row="2" Orientation="Vertical"  >

                        <TextBlock Style="{StaticResource TitleTextBlock}" Margin="0,15,0,5">
                            <Run Text="{x:Static props:Resources.My_tasks}"  />
                            <TextBlock Text="{Binding MemberPlannedEffort, StringFormat={x:Static props:Resources.N_hours}, Mode=OneWay}"  />    
                        </TextBlock>

                        <ListBox
                            x:Name="myTasksList"                              
                            Style="{StaticResource MemberTasksListBox}"                        
                            ItemsSource="{Binding MemberTasks}"/>
                        <TextBlock Style="{StaticResource NoItemsTextBlock}" DataContext="{Binding ElementName=myTasksList, Path=Items.Count}"/>

                    </StackPanel>

                    <StackPanel Grid.Column="1" Grid.Row="2" Orientation="Vertical"  Margin="20,0,0,0">
                        
                        <TextBlock Text="{x:Static props:Resources.My_observer_tasks}" Style="{StaticResource TitleTextBlock}" Margin="0,15,0,5"/>

                        <ListBox
                            x:Name="myOwnedTaskList"
                            Style="{StaticResource MemberOwnedTasksListBox}"                        
                            ItemsSource="{Binding MemberOwnedTasks}">
                            <ListBox.GroupStyle>
                                <GroupStyle>                                
                                    <GroupStyle.HeaderTemplate>
                                        <DataTemplate>
                                            <TextBlock Style="{StaticResource ItemGroupTextBlock}" Margin="10,10,0,10">
                                                <TextBlock>
                                                    <TextBlock.Style>                                                        
                                                        <Style TargetType="TextBlock" BasedOn="{StaticResource ItemGroupTextBlock}">
                                                            <Setter Property="Text" Value="{Binding Name}"/>
                                                            <Style.Triggers>
                                                                <DataTrigger Binding="{Binding Name}" Value="{x:Null}">
                                                                    <Setter Property="Text" Value="{x:Static props:Resources.not_assigned_yet}"/>
                                                                </DataTrigger>
                                                            </Style.Triggers>
                                                        </Style>
                                                    </TextBlock.Style>
                                                  </TextBlock>                                                
                                                <TextBlock Style="{StaticResource ItemGroupTextBlock}" Text="{Binding ItemCount, StringFormat='{} ({0})'}"/>
                                            </TextBlock>
                                        </DataTemplate>
                                    </GroupStyle.HeaderTemplate>
                                </GroupStyle>
                            </ListBox.GroupStyle>
                        </ListBox>
                        <TextBlock Style="{StaticResource NoItemsTextBlock}" DataContext="{Binding ElementName=myOwnedTaskList, Path=Items.Count}"/>


                    </StackPanel>



                    <StackPanel Orientation="Vertical" Grid.Column="2" Grid.RowSpan="3" Margin="20,0,0,0">
                        <TextBlock Text="{x:Static props:Resources.Working_with}" Style="{StaticResource TitleTextBlock}" Margin="0,15,0,5"/>
                        <ListBox   
                            x:Name="workingWithList"
                            Style="{StaticResource MemberWorkingWithListBox}"
                            ItemsSource="{Binding MemberWorkingWithMembers}" 
                            SF_Helpers:ItemActivation.TheCommandToRun="{Binding ShowDetailWindowCommand}"
                            SF_Helpers:ItemActivation.ActivationMode="Both"/>
                        <TextBlock Style="{StaticResource NoItemsTextBlock}" DataContext="{Binding ElementName=workingWithList, Path=Items.Count}"/>
                        
                        <TextBlock Text="{x:Static props:Resources.Important_dates}" Style="{StaticResource TitleTextBlock}" Margin="0,15,0,5"/>
                        <ListBox
                            x:Name="eventList"         
                            ItemContainerStyle="{StaticResource NoHorizontalLineDividedListBoxItem}"
                            ItemsSource="{Binding ProjectEvents}">
                            <ListBox.ItemTemplate>
                                <DataTemplate>
                                    <Grid>
                                        <Grid.ColumnDefinitions>
                                            <ColumnDefinition Width="auto"/>
                                            <ColumnDefinition Width="*"/>
                                            <ColumnDefinition Width="auto"/>
                                        </Grid.ColumnDefinitions>
                                        <Image Grid.Column="0" Style="{StaticResource EventTypeImage}" DataContext="{Binding EventType}"/>
                                        <TextBlock Grid.Column="1" Margin="10,0,0,0">
                                            <Hyperlink Command="{Binding Model.ShowProjectDetailCommand, ElementName=thisView}" CommandParameter="{Binding ProjectUId}">
                                                <TextBlock Style="{StaticResource EventDescriptionTextBlock}" TextTrimming="CharacterEllipsis"/>    
                                            </Hyperlink>
                                            <LineBreak/>
                                            <TextBlock Text="{Binding ProjectName}" TextTrimming="CharacterEllipsis" FontSize="{StaticResource SmallFontSize}" Foreground="{StaticResource SubTextBrush}"/>
                                        </TextBlock>
                                        <TextBlock                                                                    
                                            Grid.Column="2" HorizontalAlignment="Center" Margin="10,0,0,0" TextAlignment="Center"
                                            Text="{Binding DaysLeft, StringFormat={x:Static props:Resources.N_days}}" Foreground="{StaticResource WatermarkTextBrush}"/>
                                    </Grid>
                                </DataTemplate>
                            </ListBox.ItemTemplate>
                        </ListBox>
                        <TextBlock Style="{StaticResource NoItemsTextBlock}" DataContext="{Binding ElementName=eventList, Path=Items.Count}"/>
                    </StackPanel>

                    <ContentControl Style="{StaticResource LoadingAnimationContent}"/>

                </Grid>

            </ScrollViewer>
      
        </SF_Helpers:PanelLayout.Content>
    </SF_Helpers:PanelLayout>

   
    
    
    

    

</UserControl>
